package edu.whu.notepal.utils;

import edu.whu.notepal.dto.SocketBean;

import java.time.LocalDateTime;

/**
 * @author 陈磊
 */
public class SocketBeanFactory {

    public static SocketBean instance(Long fromUser,Long toUser,MessageType messageType,String msg,Long noteId){
        SocketBean socketBean = new SocketBean();
        socketBean.setFromUser(fromUser);
        socketBean.setToUser(toUser);
        socketBean.setDateTime(LocalDateTime.now());
        socketBean.setMessageType(messageType);
        socketBean.setMsg(msg);
        socketBean.setNoteId(noteId);
        return socketBean;
    }

    public static SocketBean groupInstance(Long fromUser,Long toUser,MessageType messageType,String msg,Long noteId,Long toGroup){
        SocketBean socketBean = new SocketBean();
        socketBean.setToUser(toUser);
        socketBean.setFromUser(fromUser);
        socketBean.setToGroup(toGroup);
        socketBean.setDateTime(LocalDateTime.now());
        socketBean.setMessageType(messageType);
        socketBean.setMsg(msg);
        socketBean.setNoteId(noteId);
        return socketBean;
    }

}